package com.ap.core.common.types;


/**
 * User: Ranjit.Singh
 * Validation Type used for differentiate between header and different message {@link InputMessageType} for validation purpose.
 */
public enum ValidationType {

    SUBMIT_RTP_FOR_MOB(InputMessageType.SUBMITRTPFORMOB, false),

    SUBMIT_RTP_FOR_BRN(InputMessageType.SUBMITRTPFORBRN, false),

    RETRIEVE_RTP(InputMessageType.RETRIEVERTP, false),
    
    CONFIRM_PAYMENT(InputMessageType.CONFIRMPAYMENT, false),

    REPEATED_CONFIRM_PAYMENT(InputMessageType.CONFIRMPAYMENT, true),

    ADD_MERCHANT(InputMessageType.ADDMERCHANT, false),

    REGISTER_CONSUMER(InputMessageType.REGISTERCONSUMER, false),
    
    RETRIEVE_CONSUMER_STATUS(InputMessageType.REQCONSREGSTATUS, false),
    
    RETRIEVE_REFUND_ACCOUNT(InputMessageType.GETACCFORREFUND, false),

    REQUEST_RTP_STATUS(InputMessageType.REQUESTRTPSTATUS, false);;


    private InputMessageType inputMessageType;
    private boolean isDuplicate;


    private ValidationType(InputMessageType inputMessageType, boolean isDuplicate) {
        this.inputMessageType = inputMessageType;
        this.isDuplicate= isDuplicate;
    }

    public static ValidationType valueOf(InputMessageType inputMessageType, boolean isDuplicate) {
        for (ValidationType validationType : values()) {
            if (validationType.inputMessageType == inputMessageType && validationType.isDuplicate == isDuplicate) {
                return validationType;
            }
        }

        // not found
        throw new IllegalArgumentException("Unable to determine validation type: messageType= " + inputMessageType);
    }

    public InputMessageType getInputMessageType() {
        return inputMessageType;
    }


}
